package remotecall.call;

import android.os.RemoteException;

import remotecall.streamacceptor.RemoteCallResult;

import com.zjw.zy.utils.LogUtils;

/**
 * @author ：zhong.jw
 * @date ：Created in 2022/10/17 13:24
 */
@SuppressWarnings("unchecked")
abstract class RemoteWithIt<T> extends IRemoteWithIt.Stub {
    /**
     * Construct the stub at attach it to the interface.
     *
     * @param descriptor:唯一描述符
     */
    public RemoteWithIt(String descriptor) {
        super(descriptor);
    }

    @Override
    public void onWith(RemoteCallResult it) throws RemoteException {
        try {
            onWith((T) it.getResult());
        } catch (Exception e) {
            LogUtils.e("RemoteWithIt", e.getMessage());
        }
    }

    public abstract void onWith(T t);
}

